package com.mpp.admin.service.impl;

import com.alibaba.druid.sql.visitor.functions.Char;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mpp.admin.entity.Column;
import com.mpp.admin.entity.Table;
import com.mpp.admin.mapper.GeneratorMapper;
import com.mpp.admin.service.GeneratorService;
import com.mpp.admin.util.Generator;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.WordUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author mapp
 * @des
 * @date 2019/3/13
 */
@Service
public class GeneratorServiceImpl implements GeneratorService {

    @Autowired
    private GeneratorMapper generatorMapper;

    @Override
    public Page<Table> tableList(Page page, String dataBaseName) {
        return page.setRecords(generatorMapper.tableList(page, dataBaseName));
    }

    @Override
    public List<Column> columneList(String dataBaseName, String tableName) {
        return Generator.convertJavaTypeAndName(generatorMapper.colmunList(dataBaseName, tableName));
    }
}
